package com.sugar.domain.oa.hr;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @标题：机构部门实体
 * @描述：
 * @编写者：杨浩泉
 * @日期：2011-5-9 <b>下午02:57:58</b>
 */
@Entity@Table(name="sugar_department")
public class Department {

	/** 部门编号,主键,12位 */
	private String deptNo ;
	
	/** 部门名称 */
	private String deptName ;
	
	/** 部门负责人 */
	private String deptContactPeople ;
	
	/** 部门联系电话 */
	private String deptContactTel ;
	
	/** 部门信息 */
	private String deptMsg ;
	
	/** 部门创建时间 */
	private Date deptCreTime = new Date() ;

	/** 部门与机构多对一关联关系 **/
	private Organization org ;
	
	/** 部门与员工一对多关联关系 **/
	private Set<Employee> emp ;
	
	/** 部门可创建子部门 **/
	private Set<Department> child_dept ;
	
	private Department parent_dept ;
	
	@ManyToOne
	@JoinColumn(name="dd_id")
	public Department getParent_dept() {
		return parent_dept;
	}

	public void setParent_dept(Department parentDept) {
		parent_dept = parentDept;
	}

	@OneToMany(mappedBy="parent_dept")
	@JoinColumn(name="dd_id")
	public Set<Department> getChild_dept() {
		return child_dept;
	}

	public void setChild_dept(Set<Department> childDept) {
		child_dept = childDept;
	}

	@OneToMany(mappedBy="dept")
	@JoinColumn(name="de_id")
	public Set<Employee> getEmp() {
		return emp;
	}

	public void setEmp(Set<Employee> emp) {
		this.emp = emp;
	}

	@ManyToOne
	@JoinColumn(name="od_id")
	public Organization getOrg() {
		return org;
	}

	public void setOrg(Organization org) {
		this.org = org;
	}

	@Id
	public String getDeptNo() {
		return deptNo;
	}

	public void setDeptNo(String deptNo) {
		this.deptNo = deptNo;
	}

	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public String getDeptContactPeople() {
		return deptContactPeople;
	}

	public void setDeptContactPeople(String deptContactPeople) {
		this.deptContactPeople = deptContactPeople;
	}

	public String getDeptContactTel() {
		return deptContactTel;
	}

	public void setDeptContactTel(String deptContactTel) {
		this.deptContactTel = deptContactTel;
	}

	public String getDeptMsg() {
		return deptMsg;
	}

	public void setDeptMsg(String deptMsg) {
		this.deptMsg = deptMsg;
	}

	public Date getDeptCreTime() {
		return deptCreTime;
	}

	public void setDeptCreTime(Date deptCreTime) {
		this.deptCreTime = deptCreTime;
	}
	
}
